<?php
/**
 * SocialEngine
 *
 * @category   Application_Extensions
 * @package    Page
 * @copyright  Copyright Hire-Experts LLC
 * @license    http://www.hire-experts.com
 * @version    $Id: Level.php 2010-08-31 16:05 idris $
 * @author     Idris
 */

/**
 * @category   Application_Extensions
 * @package    Page
 * @copyright  Copyright Hire-Experts LLC
 * @license    http://www.hire-experts.com
 */

class Page_Form_Admin_Level extends Engine_Form
{
  protected $_roles = array(
        'everyone' => 'Everyone',
        'registered' => 'Registered Members',
        'likes' => 'Fans, Admins and Owner',
        'team' => 'Admins and Owner'
      );

  public function init()
  {
    $this
      ->setTitle('Page Level Settings')
      ->setDescription('PAGE_FORM_ADMIN_LEVEL_DESCRIPTION');

    $levels = array();
    $table  = Engine_Api::_()->getDbtable('levels', 'authorization');
    
    foreach ($table->fetchAll($table->select()->where('level_id <> 5')) as $row){
      $levels[$row['level_id']] = $row['title'];
    }
    
    $this->addElement('Select', 'level_id', array(
      'label' => 'Member Level',
      'multiOptions' => $levels,
    ));

    $this->addElement('Radio', 'create', array(
      'label' => 'Allow Page Creation?',
      'description' => 'PAGE_FORM_ADMIN_LEVEL_VIEW_DESCRIPTION',
      'multiOptions' => array(
        0 => 'No, do not allow create pages.',
        1 => 'Yes, allow create pages.'       
      ),
      'value' => 1,
    ));
    
    $this->addElement('MultiCheckbox', 'auth_view', array(
      'label' => 'Page Privacy',
      'description' => 'Your members can choose from any of the options checked below when they decide who can see their pages.',
      'multiOptions' => array(
        'everyone' => 'Everyone',
        'registered' => 'Registered',
        'likes' => 'Fans',
        'team' => 'Team'
      ),
      'value' => array('everyone', 'registered','likes', 'team')
    ));
    
    $this->addElement('MultiCheckbox', 'auth_comment', array(
      'label' => 'Page Comment Options',
      'description' => 'Your members can choose from any of the options checked below when they decide who can post comments on their pages.',
      'multiOptions' => array(
        'registered' => 'Registered',
        'likes' => 'Fans',
        'team'  => 'Team'
      ),
      'value' => array('registered','likes', 'team')
    ));
    
    $this->addElement('MultiCheckbox', 'auth_posting', array(
      'label' => 'Page Posting Options',
      'description' => 'Your members can choose from any of the options checked below when they decide who can post content on their pages.',
      'multiOptions' => array(
        'registered' => 'Registered',
        'likes' => 'Fans',
        'team'  => 'Team'
      ),
      'value' => array('registered','likes', 'team')
    ));

    // Add submit button
    $this->addElement('Button', 'submit', array(
      'label' => 'Save Changes',
      'type' => 'submit',
      'ignore' => true
    ));
  }
}